import java.lang.StringBuilder;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class A040 {
	public static boolean armstrongDetermine(int n) {
		int tempN = n;
		int originalLength = Integer.toString(n).length();
		int curLength = (int)Math.pow(10, Integer.toString(n).length() - 1);
		int curDigit;
		int sum = 0;
		int curValue;
		while(curLength > 0) {
			curDigit = tempN / curLength;
			curValue = (int)Math.pow(curDigit, originalLength);
			sum += curValue;
			tempN %= curLength;
			curLength /= 10;
		}
		if(sum == n)
			return true;
		else
			return false;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input;
		String[] spInput;
		int start, end;
		StringBuilder output;
		
		while((input = br.readLine()) != null) {
			spInput = input.split(" ");
			start = Integer.parseInt(spInput[0]);
			end = Integer.parseInt(spInput[1]);
			
			output = new StringBuilder();
			
			while(end >= start) {
				if(armstrongDetermine(start))
					output.append(start + " ");
				start++;
			}
			if(output.length() == 0)
				output.append("none");
			
			System.out.println(output);
		}
	}
}